import { Image } from "antd";
import { FC } from "react";

interface ImgPreviewProps {
	src?: string;
	onHide: () => void;
}
const ImgPreview: FC<ImgPreviewProps> = ({ src, onHide }) => {
	return (
		<Image
			src={src}
			className="hidden"
			preview={{
				visible: Boolean(src),
				onVisibleChange(value) {
					!value && onHide?.();
				},
			}}
		/>
	);
};

export default ImgPreview;
